package com.db;

import java.util.Random;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author Eugene K.
 * Main Class for demo app.
 */
public class App {
    public static void main(String... args) {

        IntStream.range(1, 20)
            .parallel()
            .map( Math::abs )
            .filter( x -> x > 6 )
            .forEachOrdered( System.out::println );

        System.out.println("___________");
        Stream.iterate(0, i -> i + 2)
            .limit(10)
            .distinct()
            .sorted()
            .forEach( System.out::println );

        System.out.println("___________");
        System.out.println(Stream.iterate(5, i -> i + 3).parallel().findAny().get());

        System.out.println("___________");
        System.out.println(
            new Random()
                .ints()
                .parallel()
                .limit(20)
                .mapToObj( Integer::toString )
                .reduce("", (x,y) -> x+y)
        );

    }
}
